<template>
  <div>
    <nuxt/>
  </div>
</template>

<script>
export default {
  head () {
    return {
      link: [
        { rel: 'icon', type: 'image/x-icon', href: this.$store.state.webInfo.logoIco }
      ]
    }
  },
  created () {
    if (process.client) {
      this.$store.commit('INIT_WEB');
      if (!!this.$store.state.tokenInfo) {
        if (!this.$store.state.userInfo || this.$store.state.tokenInfo != this.$store.state.userInfo.token) {
          this.$store.dispatch('GET_USERINFO');
        }
      }
    }
  },
  mounted () {
    (function(){
      //插入link
      var style = document.createElement('link');
      style.href = 'https://web.sdk.qcloud.com/player/tcplayer/release/v4.2.1/tcplayer.min.css';
      style.rel = 'stylesheet';
      document.getElementsByTagName('HEAD').item(0).appendChild(style);


      var sc = document.createElement('script');
      sc.src = 'https://player.polyv.net/script/polyvplayer.min.js';
      var sList = document.getElementsByTagName('script');
      var s = sList[sList.length - 1]
      s.parentNode.insertBefore(sc, s);
      //添加两个js
            var sc1 = document.createElement('script');
            sc1.src = 'https://web.sdk.qcloud.com/player/tcplayer/release/v4.2.1/libs/hls.min.0.13.2m.js';
            var sList1 = document.getElementsByTagName('script');
            var s1 = sList1[sList1.length - 1]
            s1.parentNode.insertBefore(sc1, s1);
            //第二个
                  var sc2 = document.createElement('script');
                  sc2.src = 'https://web.sdk.qcloud.com/player/tcplayer/release/v4.3.0/tcplayer.v4.3.0.min.js';
                  var sList2 = document.getElementsByTagName('script');
                  var s2 = sList2[sList2.length - 1]
                  s2.parentNode.insertBefore(sc2, s2);


    })()
    document.addEventListener('click', () => {
      this.$store.commit('HIDE_EWM')
    })
  }
}

</script>
<style>
html {
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  word-spacing: 1px;
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}

*,
*:before,
*:after {
  box-sizing: border-box;
  margin: 0;
}

.button--green {
  display: inline-block;
  border-radius: 4px;
  border: 1px solid #3b8070;
  color: #3b8070;
  text-decoration: none;
  padding: 10px 30px;
}

.button--green:hover {
  color: #fff;
  background-color: #3b8070;
}

.button--grey {
  display: inline-block;
  border-radius: 4px;
  border: 1px solid #35495e;
  color: #35495e;
  text-decoration: none;
  padding: 10px 30px;
  margin-left: 15px;
}

.button--grey:hover {
  color: #fff;
  background-color: #35495e;
}
</style>
